<?php
declare (strict_types=1);

namespace app\index\controller;

use app\admin\model\ShortLink;

class Index extends \app\BaseController
{
    /**
     * 首页
     */
    public function index($code = '')
    {
        if ($code) {
            $exist = ShortLink::getLinkByCode($code);
            if ($exist) {
                header("Location: " . $exist['link_url']);
                exit;
            }
        }
        return $this->fetch();
    }
}
